#menu_content {
    display: flex;
    flex-direction: column;
    flex-wrap: nowrap;
    background-color: #111;
    /* Darker, modern background */
    border-right: 1px solid rgba(255, 255, 255, 0.1);
    padding: 0px;
    margin-top: 0px;
    box-shadow: 4px 0 10px rgba(0, 0, 0, 0.3);
    /* Sideways shadow */
    width: 250px;
    max-width: 250px;
    height: 100vh;
    max-height: 100vh;
    position: fixed;
    top: 0px;
    left: 0px;
    z-index: 1000;
    overflow-y: auto;
    overflow-x: hidden;
    transition: transform 0.3s ease-in-out;
    -ms-overflow-style: none;
    /* IE and Edge */
    scrollbar-width: none;
    /* Firefox */
}

#menu_content::-webkit-scrollbar {
    display: none;
    /* Chrome, Safari and Opera */
}

#app_nav {
    display: flex;
    flex-direction: column;
    flex-wrap: nowrap;
    overflow-x: hidden;
    overflow-y: hidden;
    background-color: #111;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding: none;
    border-radius: 0px;
    margin-top: 0px;
    box-shadow: 0 -2px 5px rgba(0, 0, 0, 0.1);
    min-width: 50px;
    max-width: 50px;
    min-height: 50px;
    max-height: 50px;
    border-radius: 50%;
    position: fixed;
    bottom: 6px;
    left: 256px;
    z-index: 1002;
    cursor: pointer;
}

#app_nav:hover {
    background-color: #0056b3;
}

#app_nav img {
    width: 75%;
    height: auto;
    object-fit: cover;
    margin: auto;
}

#menu_content>div {
    display: flex;
    flex-direction: column;
    justify-content: start;
    align-items: stretch;
    flex-wrap: nowrap;
    border: none;
    padding: 0px;
    border-radius: 0px;
    margin-top: 0px;
    width: 100%;
    margin-left: 0;
}

#menu_content>div#app_management {
    width: 100%;
    max-width: 100%;
    min-height: auto;
    max-height: none;
    margin-left: 0px;
    padding: 10px 0;
    background-color: #0056b3;
    /* Or keep #111 based on design */
    position: static;
    z-index: 1001;
    flex-direction: column;
    justify-content: start;
    align-items: stretch;
}

#menu_content>div#app {
    width: 100%;
    max-width: 100%;
    margin-left: 0;
    background-color: #111;
    overflow-x: hidden;
    min-height: 25vh;
    display: flex;
    flex-direction: column;
    justify-content: start;
    align-items: center;
}

#user_profile_display {
    padding: 15px;
}

#menu_content .bar,
#menu_content .bar_tile {
    display: flex;
    flex-direction: row;
    justify-content: start;
    align-items: center;
    flex-wrap: nowrap;
    margin-left: 0;
    padding: 0 10px;
}

#menu_content .bar.highlighted,
#menu_content .bar_tile:hover {
    background-color: #0056b3;
    border-radius: 5px;
}

/* Style for the links inside the menu */
#menu_content a,
#menu_content .bar_tile p {
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 10px;
    color: #007bff;
    text-decoration: none;
    padding: 12px 15px;
    margin-bottom: 5px;
    border-radius: 5px;
    transition: background-color 0.3s ease, color 0.3s ease;
    width: 100%;
}

#app_nav p {
    white-space: nowrap;
    display: block;
    color: white;
    margin: auto;
    text-decoration: none;
    padding: 0px;
    border-radius: 3px;
    transition: background-color 0.3s ease;
}

#menu_content div#app_management a {
    color: white;
    padding: 12px 15px;
}

#menu_content #weblogo {
    margin: 15px auto;
    display: block;
    max-height: 60px;
    padding: 5px;
}

/* Hover effect for links */
#menu_content div#app_management a:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: #fff;
}

#menu_content div#app a:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: #fff;
}

#menu_content div#app .highlighted a,
#menu_content div#app_management .highlighted a {
    background-color: transparent;
    color: #ffffff;
}

#menu-toggle {
    display: none;
}

/* Adjust main content when sidebar is present */
#main_content {
    width: calc(100vw - 500px) !important;
    margin-left: 375px !important;
    margin-right: 0 !important;
    box-sizing: border-box;
    padding: 2vw;
}

/* Mobile styles */
@media (max-width: 768px) {
    #menu_content {
        width: 250px;
        max-width: 80vw;
        height: 100vh;
        max-height: 100vh;
        transform: translateX(-100%);
        right: auto;
        left: 0;
        background-color: #111;
        box-shadow: none;
    }

    #menu_content.opennav {
        transform: translateX(0);
        box-shadow: 4px 0 10px rgba(0, 0, 0, 0.5);
        /* Shadow appears when open */
    }

    #menu_content>div {
        flex-direction: column;
        justify-content: start;
        align-items: stretch;
        padding-top: 60px;
        /* Space for the toggle button */
        height: auto;
        max-height: none;
        margin-left: 0;
    }

    #menu_content>div#app {
        width: 100%;
        max-width: 100%;
        margin: 0;
    }

    #menu_content>div#app_management {
        width: 100%;
        max-width: 100%;
        margin: 0;
        padding: 10px 0;
        position: static;
    }

    #menu_content .bar.highlighted {
        border-radius: 0;
    }

    #menu_content .bar,
    #menu_content .bar_tile {
        margin-left: 0;
        width: 100%;
    }

    #menu_content a {
        white-space: normal;
    }

    #menu-toggle {
        background-color: #0056b3;
        color: white;
        border: none;
        padding: 10px;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 1.5rem;
        cursor: pointer;
        position: fixed;
        width: 50px;
        height: 50px;
        top: 10px;
        left: 10px;
        z-index: 1001;
        border-radius: 5px;
        box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
    }

    #main_content {
        width: 100vw !important;
        margin-left: 0 !important;
        padding-top: 80px;
        /* Offset for toggler */
    }
}

/* Modern App Selector Modal Styles */
.modern-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(5px);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.modern-modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modern-modal {
    background: #1e1e1e;
    border-radius: 12px;
    width: 90%;
    max-width: 500px;
    padding: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    transform: translateY(20px) scale(0.95);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
}

.modern-modal-overlay.active .modern-modal {
    transform: translateY(0) scale(1);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 15px;
    margin-bottom: 20px;
}

.modal-header h2 {
    margin: 0;
    color: #fff;
    font-size: 1.2rem;
}

.modal-header .close-btn {
    background: none;
    border: none;
    color: #aaa;
    font-size: 1.5rem;
    cursor: pointer;
    transition: color 0.3s;
}

.modal-header .close-btn:hover {
    color: #fff;
}

.app-grid {
    display: grid !important;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)) !important;
    gap: 15px !important;
    max-height: 60vh !important;
    overflow-y: auto !important;
    padding: 10px !important;
    width: 100% !important;
}

.app-grid .bar {
    margin: 0 !important;
    width: 100% !important;
    display: flex !important;
    padding: 0 !important;
}

.app-grid .bar a {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 10px !important;
    padding: 15px !important;
    background: rgba(255, 255, 255, 0.05) !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    border-radius: 8px !important;
    color: #fff !important;
    text-decoration: none !important;
    transition: all 0.3s ease !important;
    text-align: center !important;
    width: 100% !important;
}

.app-grid .bar a i {
    font-size: 2rem !important;
    color: #007bff !important;
    margin-bottom: 5px !important;
}

.app-grid .bar a:hover {
    background: rgba(0, 123, 255, 0.2) !important;
    border-color: #007bff !important;
    transform: translateY(-2px) !important;
}

.app-grid .bar.highlighted a,
.app-grid .bar.highlighted a:hover {
    background: #007bff !important;
    color: #fff !important;
    border-color: #007bff !important;
}

.app-grid .bar.highlighted a i {
    color: #fff !important;
}

/* =========================================================
   UNIFIED MODAL SYSTEM
   ========================================================= */

.unified-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(5px);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.unified-modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Override default inline styles for toggling */
.unified-modal-overlay[style*="display: block"],
.unified-modal-overlay[style*="display: flex"] {
    opacity: 1 !important;
    visibility: visible !important;
}

.unified-modal {
    background: #1e1e1e;
    border-radius: 12px;
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    padding: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    transform: translateY(20px) scale(0.95);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
}

.unified-modal-overlay.active .unified-modal,
.unified-modal-overlay[style*="display: block"] .unified-modal,
.unified-modal-overlay[style*="display: flex"] .unified-modal {
    transform: translateY(0) scale(1);
}

.unified-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 15px;
    margin-bottom: 20px;
}

.unified-modal-header h2 {
    margin: 0;
    color: #00B4D8;
    font-size: 1.4rem;
    font-weight: 700;
}

.unified-modal-header .close-btn {
    background: none;
    border: none;
    color: #aaa;
    font-size: 1.5rem;
    cursor: pointer;
    transition: color 0.3s;
}

.unified-modal-header .close-btn:hover {
    color: #fff;
}

.unified-modal-body {
    overflow-y: auto;
    padding-right: 5px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.unified-modal-body label {
    display: block;
    color: #7FDBFF;
    margin-bottom: 5px;
    font-size: 1rem;
}

.unified-modal-body input,
.unified-modal-body select,
.unified-modal-body textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #7FDBFF;
    border-radius: 5px;
    background-color: #001f3f;
    color: white;
    font-size: 1rem;
    box-sizing: border-box;
    transition: border-color 0.3s;
}

.unified-modal-body input:focus,
.unified-modal-body select:focus,
.unified-modal-body textarea:focus {
    outline: none;
    border-color: #0074D9;
}

.unified-modal-footer {
    display: flex;
    justify-content: space-between;
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.unified-modal-btn {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 1rem;
}

.unified-modal-btn.primary {
    background-color: #007bff;
    color: white;
}

.unified-modal-btn.primary:hover {
    background-color: #0056b3;
}

.unified-modal-btn.secondary {
    background-color: #fc2011;
    color: white;
}

.unified-modal-btn.secondary:hover {
    background-color: #c0180c;
}

/* Custom Scrollbar for Modal Body */
.unified-modal-body::-webkit-scrollbar {
    width: 6px;
}

.unified-modal-body::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
}

.unified-modal-body::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
}
